﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Transferencia.aspx.cs" Inherits="Transferencia_Transferencia" MasterPageFile="~/Master.master" EnableEventValidation="false" %>

<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContenidoPrincipal" Runat="Server">


    <asp:ScriptManager ID="ScriptManager1" runat="server" 
        onasyncpostbackerror="ScriptManager1_AsyncPostBackError" AsyncPostBackErrorMessage="" AsyncPostBackTimeout="5">
    </asp:ScriptManager>
    <table style="width: 439px" class="Tabla" id="TABLE1" align="center" >
        <tr>
            <td align="center" colspan="3" style="width: 400px; height: 15px" class="Titulo">
                TRANSFERENCIA</td>
        </tr>   
        <tr>
            <td style="width: 221px; height: 15px" valign="top">
                            <asp:Label ID="Label1" runat="server" Text="Opcion de Lectura"></asp:Label></td>
            <td style="width: 16px; height: 15px" valign="top">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Seleccione la opcion de lectura" ControlToValidate="rblOpcion" Display="Dynamic" SetFocusOnError="True" ValidationGroup="Iniciar">*</asp:RequiredFieldValidator></td>
            <td style="color: #663300; height: 15px">
                <asp:RadioButtonList ID="rblOpcion" runat="server" RepeatDirection="Horizontal" Width="183px">
                    <asp:ListItem Value="1">Codigo de Barras</asp:ListItem>
                    <asp:ListItem Value="2">RFID</asp:ListItem>
                </asp:RadioButtonList></td>
        </tr>
        <tr>
            <td style="width: 221px; height: 15px" valign="top">
                Observaciones:</td>
            <td style="width: 16px; height: 15px" valign="top">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtObservacion"
                    Display="Dynamic" ErrorMessage="Ingrese la Observacion para la transferencia" SetFocusOnError="True"
                    ValidationGroup="Iniciar">*</asp:RequiredFieldValidator></td>
            <td style="color: #663300; height: 15px">
                <asp:TextBox ID="txtObservacion" runat="server" CssClass="TextBox" 
                    Font-Bold="False" Height="60px"
                    TextMode="MultiLine" Width="307px"></asp:TextBox></td>
        </tr>
        <tr>
            <td style="width: 221px; height: 22px;">
            </td>
            <td style="width: 16px; height: 22px;">
            </td>
            <td align="right" style="height: 22px">
                &nbsp;<asp:Button ID="btnIniciar" runat="server" CssClass="Boton" OnClick="btnIniciar_Click"
                    Text="Iniciar" ValidationGroup="Iniciar" Width="68px" />
                <asp:Button ID="btnDetener" runat="server" CssClass="Boton" OnClick="btnDetener_Click"
                    Text="Detener" />&nbsp;
            </td>
        </tr>
        <tr>
            <td align="center" style="height: 10px" colspan="3">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <table style="width: 407px; height: 2px">
                            <tr>
                                <td style="width: 20px; height: 15px;">
                                    <asp:Label ID="Label3" runat="server" Width="44px">Inicio:</asp:Label></td>
                                <td style="width: 3px; height: 15px;" align="left">
                                    <asp:Label ID="lblInicio" runat="server" Width="143px"></asp:Label></td>
                                <td colspan="1" style="width: 43px; height: 15px;">
                                    <asp:Label ID="Label5" runat="server" Width="27px">Final:</asp:Label></td>
                                <td colspan="1" style="height: 15px" align="left">
                                    <asp:Label ID="lblTimer" runat="server" Width="157px"></asp:Label></td>
                            </tr>
                            <tr>
                                <td colspan="4">
                                    <asp:Label ID="lblUltima" runat="server" Width="135px">Numero de Recepción:  </asp:Label>
                                    <asp:Label ID="lblRecepcion" runat="server" Width="168px"></asp:Label></td>
                            </tr>
                        </table>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer" EventName="Tick" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td colspan="3" style="width: 400px; height: 7px">                
                 <table id="tblSerial"  runat="server" visible="false">
                    <tr>
                        <td style="width: 739px">
                            <asp:Label ID="Label2" runat="server" Text="Serial #" Width="111px"></asp:Label></td>
                        <td style="width: 158px">
                            <asp:TextBox ID="txtSerial" runat="server" Width="259px" CssClass="TextBox" 
                                onkeydown="Enter(event);" Height="16px" AutoPostBack="True" 
                                ontextchanged="txtSerial_TextChanged"></asp:TextBox></td>
                    </tr>
                    <tr>                        
                        <td colspan="2">                            
                            <asp:HiddenField ID="hdn" runat="server" Value="" />                            
                        </td>
                    </tr>
                </table>                      
            </td>
        </tr>
        
    </table>
    <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="Label" ShowMessageBox="True"
        ShowSummary="False" ValidationGroup="Grabar" />
    &nbsp;
    <asp:SqlDataSource ID="sdsRecepcion" runat="server" ConnectionString="<%$ ConnectionStrings:CEDIS %>" SelectCommand="RegistraTransferencia" SelectCommandType="StoredProcedure">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtObservacion" DefaultValue="-1" Name="p_Descripcion"
                PropertyName="Text" Type="String" />
            <asp:Parameter DefaultValue="-1" Name="p_IDUsuario" Type="Int32" />
            <asp:Parameter DefaultValue="-1" Name="p_Tipo" Type="Int32" />
            <asp:Parameter DefaultValue="-1" Name="p_IDTransferencia" Type="Int32" />            
        </SelectParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="sdsBodegaFisica" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CEDIS %>" 
        SelectCommand="SELECT ID, NOMBRE FROM BODEGAFISICA">
    </asp:SqlDataSource>
    <asp:Timer ID="Timer" runat="server" OnTick="Timer_Tick" Interval="4000" Enabled="False">
    </asp:Timer>
    <table style="width: 521px" class="Tabla" align="center">
        <tr>
            <td align="center" style="height: 15px" class="Titulo">
                SERIALES LEÍDOS - Transferencia Generada&nbsp;
            </td>
        </tr>
        <tr>
            <td style="height: 15px">
                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                <asp:GridView ID="grdRecepcion" runat="server" AllowSorting="True"
                    BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
                    CellPadding="4" ForeColor="Black" GridLines="Vertical" 
                    Width="508px">
                    <FooterStyle BackColor="#CCCC99" />
                    <RowStyle BackColor="#F7F7DE" Font-Bold="False" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
                    <HeaderStyle Font-Bold="True" ForeColor="White" HorizontalAlign="Center" CssClass="HeaderStyle" />
                    <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer" EventName="Tick" />
                    </Triggers>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
    </table>
</asp:Content>

